package com.springboot.base.controller;

import com.springboot.base.common.ServerResponse;
import com.springboot.base.model.Category;
import com.springboot.base.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller("/category")
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private ICategoryService categoryService;

    @ResponseBody
    @GetMapping("/list")
    public ServerResponse list(){
        List<Category> list = categoryService.selectAll();

        return ServerResponse.createBySuccessData(list);
    }

}
